import Fly from 'flyio/dist/npm/wx'
import toast from '@/utils/toast.js'
const fly = new Fly()
fly.config.baseURL = 'https://api-hmugo-web.itheima.net/api/public/v1'


//添加请求拦截器
fly.interceptors.request.use(request => {
  uni.showLoading({
    title: '加载中...'
  })
  return request
})

//添加响应拦截器
fly.interceptors.response.use(
  response => {
    uni.hideLoading()
    return response.data
  }, err => {
    toast.error('网络错误')
    return Promise.reject('响应失败')
  })
export default fly
